<%@ page pageEncoding="UTF-8"%>
<%@ include file="/common/token.jsp"%>
<%
	Integer patientUid = input.getInt("patient_uid", -1);
	Integer doctorUid = input.getInt("doctor_uid", -1);
	Integer surveyId = input.getInt("survey_id", -1);
	Integer kind = input.getInt("kind", 2);
	String type =  input.getDesc("type", "");
	String name =  input.getDesc("name", "");
	String treatProgress =  input.getDesc("treat_progress", "");
	String imgs =  input.getDesc("imgs", "");
	List<String> imgsList = stringToList(imgs);
	String voices =  input.getDesc("voices", "");
	List<String> voicesList = stringToList(voices);
	String date =  input.getDesc("date", "");
	String diagnose =  input.getDesc("diagnose", "");
	String visitHospitalName =  input.getDesc("visit_hospital_name", "");
	String visitDeptName =  input.getDesc("visit_dept_name", "");
	String visitDoctorName =  input.getDesc("visit_doctor_name", "");
	if (!isChinaNameLegal(visitDoctorName) && !"".equals(visitDoctorName)) {
		Tools.encryptPrint(out, new Message(30000, "医生姓名为2-10位中文汉字"));
		return;
	}
	Map timeLine = new HashMap();
	if (kind == 8) {
		timeLine.put("oid", surveyId);
	}
	timeLine.put("date", date);
	timeLine.put("patient_uid", patientUid);
	timeLine.put("doctor_uid", doctorUid);
	timeLine.put("kind", kind);
	timeLine.put("treat_progress", treatProgress);
	timeLine.put("imgs", JSONUtil.toJson(imgsList));
	timeLine.put("voices", JSONUtil.toJson(voicesList));
	timeLine.put("type", type);
	timeLine.put("name", name);
	timeLine.put("hospital", hospital);
	timeLine.put("status", STATUS_ENABLE);
	timeLine.put("json", "{}");
	timeLine.put("diagnose", diagnose);
	timeLine.put("visit_hospital_name", visitHospitalName);
	timeLine.put("visit_dept_name", visitDeptName);
	timeLine.put("visit_doctor_name", visitDoctorName);
	timeLine.put("create_time", System.currentTimeMillis());
	Integer id = (Integer)DBTools.db("basedb").addItem("time_line", timeLine);
	if (id == null) 
		Tools.encryptPrint(out, new Message(-1, "创建失败"));
	else {
		msg.put("id", id);
		Tools.encryptPrint(out, msg);
	}
%>
